package com.payment.ktb.activity.main1;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.android.volley.VolleyError;
import com.payment.ktb.Interface.HttpCallbackListener;
import com.payment.ktb.R;
import com.payment.ktb.activity.BaseActivity;
import com.payment.ktb.activity.MainActivity;
import com.payment.ktb.constants.HttpActions;
import com.payment.ktb.constants.HttpUrls;
import com.payment.ktb.utils.AlertDialogUtils;
import com.payment.ktb.utils.HttpUtils;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by admin on 2017/9/9.
 */

public class OrderConfirmSuccessActivity extends BaseActivity {



    @BindView(R.id.tv_orderconfirmsuccess_amount)
    TextView tv_orderconfirmsuccess_amount;
    @BindView(R.id.tv_orderconfirmsuccess_goodsname)
    TextView tv_orderconfirmsuccess_goodsname;
    @BindView(R.id.tv_orderconfirmsuccess_bankname)
    TextView tv_orderconfirmsuccess_bankname;
    @BindView(R.id.tv_orderconfirmsuccess_bankno)
    TextView tv_orderconfirmsuccess_bankno;
    @BindView(R.id.tv_orderconfirmsuccess_orderno)
    TextView tv_orderconfirmsuccess_orderno;
    @BindView(R.id.tv_orderconfirmsuccess_ordertime)
    TextView tv_orderconfirmsuccess_ordertime;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_orderconfirmsuccess);
        ButterKnife.bind(this);
        hideTitleBack();
        initTitle("订单确认");
        initData();
    }

    private void initData() {
        tv_orderconfirmsuccess_amount.setText("¥ " + handleFen2Yuan(getIntent().getStringExtra("amount")));
        tv_orderconfirmsuccess_goodsname.setText(getIntent().getStringExtra("goodsName"));

        if (!TextUtils.isEmpty(getIntent().getStringExtra("goodsName")) && "Vip1".equals(getIntent().getStringExtra("goodsName"))) {
            tv_orderconfirmsuccess_goodsname.setText("会员购买");
        }else if (!TextUtils.isEmpty(getIntent().getStringExtra("goodsName")) && "Vip2".equals(getIntent().getStringExtra("goodsName"))) {
            tv_orderconfirmsuccess_goodsname.setText("会员购买");
        } else if (!TextUtils.isEmpty(getIntent().getStringExtra("goodsName")) && "151".equals(getIntent().getStringExtra("goodsName"))) {
            tv_orderconfirmsuccess_goodsname.setText("后台管理费");
        }

        tv_orderconfirmsuccess_bankname.setText(getIntent().getStringExtra("cardBank"));
        tv_orderconfirmsuccess_bankno.setText(getIntent().getStringExtra("cardNo"));
        tv_orderconfirmsuccess_orderno.setText(getIntent().getStringExtra("orderNo"));
        tv_orderconfirmsuccess_ordertime.setText(getIntent().getStringExtra("orderTime"));
    }

    private String handleFen2Yuan(String fen) {
        if (fen.equals("0")) {
            return "0.00";
        }
        double srcFen = Double.valueOf(fen);
        double roundSrcFen = Math.round(srcFen);
        return String.valueOf(roundSrcFen/100);
    }

    @OnClick({R.id.btn_orderconfirmsuccess_confirm})
    public void clickEvent(View view) {

        switch (view.getId()) {


            //确定按钮
            case R.id.btn_orderconfirmsuccess_confirm:
                startActivity(MainActivity.class);
                break;

        }


    }





}
